<?php $this->load->view('inc/header.php');?>
<?php $this->load->view('data/inc_sm.php');?>

<div class="col-right">

	<div class="box">
		<div class="box-t">
			<span class="fl">数据列表</span>	
			<span class="fr">
				<?php html_select($opt_model,fd('mid'),'id="slt-model"','--选择模型--');?>
			</span>
		</div>
		<div class="box-c" id="cat-tree">
			<?php if(!empty($mid)):?>
			<table class="tbl-list">
				<thead>
					<tr>	
						<?php foreach ($attr as $k => $v):?>
						<th><?php echo $v['title'];?></th>
						<?php endforeach;?>

						<th width="200px">操作</th>
					</tr>
				</thead>
				<tbody>
					<?php foreach ($list as $k => $v):?>
					<tr>	
						<?php foreach ($attr as $kk => $vv):?>
						<td><?php echo $v[$vv['name']];?></td>
						<?php endforeach;?>
						<td>
							<a href="#">删除</a>&nbsp;
							<a href="#">编辑</a>
						</td>
					</tr>
					<?php endforeach;?>
				</tbody>
			</table>

			<?php echo $pagenav;?>

			<?php else:?>
				<div>请选择模型先！</div>
			<?php endif;?>
		</div>
	</div>

</div>

<?php $this->load->view('inc/footer.php');?>

<script type="text/javascript">$(function(){

	$('#slt-model').change(function(){
		var mid = $(this).val();
		var url = '<?php echo site_url("c=model&m=set_mid&mid=");?>'+mid;
		$.ajax({
			type: 'get',
			url: url,
			async: false,
			dataType:'json',
			success:function(msg){
	    		ajax_back(msg);
			}
		});		
	});

});</script>
